import numpy as np
from drawcluster2 import drawcluster2
from ldp_mst_opt import LDPMST_OPT

def run_ldp_aggregation():

    # 数据集名字                 簇数
    # aggregation.txt           7
    # d6.txt                    4
    # E6.txt                    7
    # t4.txt                    6
    # t7.txt                    9
    # t8.dat                    8

    A = np.loadtxt(r'F:\A-Project\Matlab\LDP-MST-master\synthetic data sets\t8.dat')
    N, dim = A.shape
    print(f'读入数据：{N} 个点，{dim} 维')

    clu_num = 8     # 期望聚类数
    A, cl, ncluster = LDPMST_OPT(A, clu_num)  # 运行 LDP-MST 聚类

    print(f'初始聚类标签:{clu_num}')
    print(f'最终聚类标签：{str(cl)}')
    drawcluster2(A, cl, ncluster)

if __name__ == '__main__':
    run_ldp_aggregation()
